package org.example;

import java.time.LocalDate;
import java.util.Scanner;

public class HotelCLI {
    private static final Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        while (true) {
            System.out.println("\n=== 酒店管理系统 ===");
            System.out.println("1. 客房管理");
            System.out.println("2. 客户登记");
            System.out.println("3. 房间预订");
            System.out.println("4. 退房结算");
            System.out.println("5. 退出系统");
            System.out.print("请选择操作：");

            int choice = scanner.nextInt();
            scanner.nextLine();  // 清除缓冲区

            switch (choice) {
                case 1:
                    manageRooms();
                    break;
                case 3:
                    bookRoom();
                    break;
                // 其他case处理...
            }
        }
    }

    private static void bookRoom() {
        System.out.print("输入客户ID：");
        int guestId = scanner.nextInt();
        System.out.print("输入房间号：");
        int roomId = scanner.nextInt();

        if (new HotelService().bookRoom(guestId, roomId, LocalDate.now())) {
            System.out.println("预订成功！");
        } else {
            System.out.println("预订失败，请检查房间状态");
        }
    }
}
